package com.lesama.test;

import java.util.Scanner;

public class StringTest2 {
    public static void main(String[] args) {
        countChar();
    }
    public static void countChar() {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入要统计的字符串");
        String str = sc.nextLine();
        int lower = 0;
        int upper = 0;
        int number = 0;
        for (int i = 0; i < str.length(); i++) {
            if(str.charAt(i) >= 'a' && str.charAt(i) <= 'z') {
                lower++;
            } else if(str.charAt((i)) >= 'A' && str.charAt(i) <= 'Z') {
                upper++;
            } else if(str.charAt(i) >= '0' && str.charAt(i) <= '9') {
                number++;
            }
        }
        System.out.println("大写字母：" + upper);
        System.out.println("小写字母：" + lower);
        System.out.println("数字字母：" + number);
    }
}
